package com.huabo.utils;

/**
 * Created by Jackie Liu on 2017/6/30.
 */
public class ResponseUtils {

    private ResponseUtils() {

    }

    public static final Response success(Object data) {
        return new Response(data);
    }

    public static final Response success(String message, Object data) {
        return new Response(CommonReturnCode.SUCCESS.code(), message, data);
    }

    public static final PageResponse success(Page<?> page) {
        return new PageResponse(CommonReturnCode.SUCCESS, page);
    }

    public static final Response success(String message) {
        return new Response(CommonReturnCode.SUCCESS.code(), message, null);
    }

    public static final Response error(String message) {
        return new Response(CommonReturnCode.INTERNAL_SERVER_ERROR.code(), message, null);
    }

    public static final Response warn(String message) {
        return new Response(CommonReturnCode.WARN.code(), message, null);
    }
}
